import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait

dr = webdriver.Chrome()
dr.get("https://yun.itheima.com/")
dr.maximize_window()
time.sleep(3)
# 进行frame切换
f = dr.find_element(By.ID,"chatIframe")
dr.switch_to.frame(f)
# 输出当前时间
print("开始时间：",time.strftime("%H:%M:%S"))
e = WebDriverWait(dr,10,1).until(lambda x:x.find_element(By.CSS_SELECTOR,".chatmsg .service"))
print(e.text)
print("结束时间：",time.strftime("%H:%M:%S"))
dr.quit()